home *** CD-ROM | disk | FTP | other *** search
- instanceof class student;
-
- assume string house; integer year; instanceof course univ_course in
- student := class.new(
- "student",
- [
- {
- null function set( string pname; integer page;
- string cname; integer clength;
- string shouse; integer syear )
- {
- assume null function pset(string s;integer p) in
- {
- write("\n\npname :",pname,", page :",page,"\n\n");
- pset(pname,page);
- };
- univ_course.set(cname,clength);
- house := shouse; year := syear;
- };
- },
- {
- null function show()
- {
- write("\n\nStudent details:\n");
- (*assume null function pshow() in
- pshow();*)
- (* need to be able to say super.show *)
- assume instanceof person super in
- super.show();
- univ_course.show();
- write("\nStudent lives in ",house);
- write(" and is in year ",year,"\n");
- write("There are ",univ_course.get_length()-year+1,
- " years left\n\n");
- };
- },
- {
- null function s()
- {
- sys_describe_object();
- };
- }
- ],
- [
- {
- string house;
- integer year;
- create course univ_course;
- }
- ]
- );
-
- person.replace_method("show",{ integer function show() { return 1; }; } );
- person.delete_method("show",true);
-